The present invention relates in general to encoding circuits and in particular to a method and apparatus for converting thermometer code to adjacent binary code.
A number may be represented by a thermometer code wherein each successive bit of a data word is assigned a progressively larger value, all of the bits having assigned values below or the same as the number being set to a logical true state, and all of the bits having values higher than the number being set to a logical false state. In a typical analog-to-digital (A/D) converter, a reference voltage is divided into a set of progressively larger reference voltage quantum levels and a comparator associated with each quantum level compares an analog input voltage with the voltage quantum, generating an output true state if the input voltage is higher than the voltage quantum reference. The outputs of all of the comparators thus form the bits of a thermometer code representing the magnitude of the input voltage when arranged in order of the associated reference voltage quantum level magnitudes.
In comparison to most other commonly used codes, thermometer codes do not represent numbers efficiently in terms of the number of bits required. For instance an eight bit thermometer code can represent any one of 9 different numbers (including 0) while a typical eight bit binary code can represent 256 different numbers. Therefore the thermometer code output of an A/D converter is usually converted by an encoding circuit to another more compact and useful binary code before being transmitted as data to external circuits.
A problem arises when one or more of the bits of a thermometer code are at an invalid logic level, intermediate in voltage between high and low logic levels, causing instability in the output of one or more of the output bits of a thermometer-to-binary code conversion circuit. For instance, the output of each comparator of an A/D converter is ideally either high or low, depending on the magnitude of the input voltage, but in practice one comparator of the A/D converter may produce an invalid level output which is neither of high nor low logic level when the input voltage is sufficiently close to the reference voltage applied to the comparator. Also, if the input voltage is slewing rapidly past several reference voltages, several comparator outputs may be invalid simultaneously. To prevent invalid bits from being propagated through the code conversion circuit, the thermometer code output of an A/D converter is typically applied to a set of clocked latches having positive feedback circuits to drive their outputs to stable high or low logic levels if their inputs are invalid. The stabilized output of each latch is then applied to the code conversion circuit.
It is possible, though, for one of the latches to remain at an invalid or "metastable" logic state for a considerable period of time before the positive feedback circuit causes the output to regenerate to a valid level. This invalid logic bit can typically cause logical errors in the encoding circuit, producing an output code not representative of the input voltage applied to the A/D converter. Thus the sampling rate of a typical A/D converter using this approach is limited, since sufficient time must be allowed for the latches to fully regenerate. The use of multi-stage latch "pipelines" between the comparators and the code conversion circuit has permitted higher frequency operation since each latch in the pipeline helps drive a metastable input to a stable state without having to completely switch states during a single clock cycle. However, this solution is hardware intensive, requiring multiple latches for each bit of the thermometer code, and the frequency of operation is still somewhat limited by the limited number of pipeline stages that can be practically realized.
What would be useful would be a method and apparatus which would rapidly convert a thermometer code subject to metastable level bits to a more compact code without introducing logical errors from the invalid input bits. The compact code could then be "pipelined" to remove metastable bits at much lower cost.